package com.ipmirror.beans;

import com.ipmirror.common.base.AbstractBaseBean;
import com.ipmirror.component.PopupSelectCustomer;
import com.ipmirror.component.interfaces.IPopupSelectCustomer;
import com.ipmirror.rebuild.entities.MobileProduct;
import com.ipmirror.rebuild.interfaces.IMobileProductBean;
import org.apache.log4j.Logger;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.model.SelectItem;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by denny
 * User: denny
 * Date: Jan 19, 2011
 * Time: 11:07:22 AM
 */
public class MobileProductCreateBean extends AbstractBaseBean implements IPopupSelectCustomer{
    private static Logger log = Logger.getLogger(MobileProductCreateBean.class);
    private static List<SelectItem> statusList;
    private MobileProduct mobileProduct;
    private PopupSelectCustomer popupSelectCustomer;

    @EJB(name = "IPMEjb/MobileProductBean/local")
    private IMobileProductBean mobileProductService;
    private String defaultAssignToName;
    private String productCategoryName;

    public MobileProductCreateBean() {
    }

    @PostConstruct
    public void init() {
        log.info("init MobileProductCreateBean.");
        mobileProduct=new MobileProduct();
    }

    public List<SelectItem> getStatusList() {
        if (statusList == null) {
            statusList = new ArrayList<SelectItem>(0);
            List<String> statusValue = mobileProductService.showStatus();
            for (String str : statusValue) {
                statusList.add(new SelectItem(str, str));
            }
        }
        return statusList;
    }

    public void setStatusList(List<SelectItem> statusList) {
        this.statusList = statusList;
    }

    public void newCancel() {

    }

    public void newSave() {

    }

    public boolean validate(){
        return true;
    }

    public MobileProduct getMobileProduct() {
        return mobileProduct;
    }

    public void setMobileProduct(MobileProduct mobileProduct) {
        this.mobileProduct = mobileProduct;
    }

    public void selectOk() {

    }

    public void closeOrCancelPopup() {

    }

    public PopupSelectCustomer getPopupSelectCustomer() {
        return popupSelectCustomer;
    }

    public void setPopupSelectCustomer(PopupSelectCustomer popupSelectCustomer) {
        this.popupSelectCustomer = popupSelectCustomer;
    }

    public void setDefaultAssignToName(String defaultAssignToName) {
        this.defaultAssignToName = defaultAssignToName;
    }

    public String getDefaultAssignToName() {
        return defaultAssignToName;
    }

    public void setProductCategoryName(String productCategoryName) {
        this.productCategoryName = productCategoryName;
    }

    public String getProductCategoryName() {
        return productCategoryName;
    }
}
